package sort;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class IntSort {
    public static void main(String[] args) {
        //对存储在list中的整型数据进行排序
        List<Integer> list=new ArrayList<Integer>();
        list.add(5);
        list.add(9);
        list.add(3);
        list.add(1);
        System.out.println("排序之前的数据:");
        for (int n:list){
            System.out.print(n+" ");
        }
        System.out.println();
        System.out.println("排序之后的数据:");
        Collections.sort(list);
        for (int n:list){
            System.out.print(n+" ");
        }
    }
}
